@@ -155,6 +155,7 @@ WATERMARK_LOGO = os.path.join(PROJ_DIR, 'static/pai2/img/paiai_96_96.png').repla  | 
            ||
| 155 | 155 | 
                 | 
            
| 156 | 156 | 
                # 域名设置  | 
            
| 157 | 157 | 
                DOMAIN = 'http://xfoto.com.cn'  | 
            
| 158 | 
                +IMG_DOMAIN = 'http://img.xfoto.com.cn'  | 
            |
| 158 | 159 | 
                 | 
            
| 159 | 160 | 
                try:  | 
            
| 160 | 161 | 
                from local_settings import *  | 
            
                @@ -11,6 +11,23 @@ server {
               | 
            ||
| 11 | 11 | 
                # the port your site will be served on  | 
            
| 12 | 12 | 
                listen 80;  | 
            
| 13 | 13 | 
                # the domain name it will serve for  | 
            
| 14 | 
                + server_name .img.xfoto.com.cn; # substitute your machine's IP address or FQDN  | 
            |
| 15 | 
                + charset utf-8;  | 
            |
| 16 | 
                +  | 
            |
| 17 | 
                + # max upload size  | 
            |
| 18 | 
                + client_max_body_size 75M; # adjust to taste  | 
            |
| 19 | 
                +  | 
            |
| 20 | 
                + # Django media  | 
            |
| 21 | 
                +    location /  {
               | 
            |
| 22 | 
                + alias /home/paiai/work/pai2/media; # your Django project's media files - amend as required  | 
            |
| 23 | 
                + }  | 
            |
| 24 | 
                +}  | 
            |
| 25 | 
                +  | 
            |
| 26 | 
                +# configuration of the server  | 
            |
| 27 | 
                +server {
               | 
            |
| 28 | 
                + # the port your site will be served on  | 
            |
| 29 | 
                + listen 80;  | 
            |
| 30 | 
                + # the domain name it will serve for  | 
            |
| 14 | 31 | 
                server_name .api.xfoto.com.cn; # substitute your machine's IP address or FQDN  | 
            
| 15 | 32 | 
                charset utf-8;  | 
            
| 16 | 33 | 
                 | 
            
                @@ -11,7 +11,7 @@ class UUIDInfoAdmin(admin.ModelAdmin):  | 
            ||
| 11 | 11 | 
                 | 
            
| 12 | 12 | 
                 | 
            
| 13 | 13 | 
                class PhotosInfoAdmin(admin.ModelAdmin):  | 
            
| 14 | 
                -    list_display = ('lensman_id', 'session_id', 'photo_id', 'p_photo_path', 'status', 'created_at', 'updated_at')
               | 
            |
| 14 | 
                +    list_display = ('lensman_id', 'session_id', 'photo_id', 'p_photo_path', 'm_photo_path', 'l_photo_path', 'r_photo_path', 'status', 'created_at', 'updated_at')
               | 
            |
| 15 | 15 | 
                     list_filter = ('lensman_id', 'status')
               | 
            
| 16 | 16 | 
                 | 
            
| 17 | 17 | 
                 | 
            
                @@ -49,19 +49,19 @@ class PhotosInfo(CreateUpdateMixin):  | 
            ||
| 49 | 49 | 
                 | 
            
| 50 | 50 | 
                @property  | 
            
| 51 | 51 | 
                def p_photo_url(self):  | 
            
| 52 | 
                -        return u'{0}/media/{1}'.format(settings.DOMAIN, self.p_photo_path) if self.p_photo_path else ''
               | 
            |
| 52 | 
                +        return u'{0}/{1}'.format(settings.IMG_DOMAIN, self.p_photo_path) if self.p_photo_path else ''
               | 
            |
| 53 | 53 | 
                 | 
            
| 54 | 54 | 
                @property  | 
            
| 55 | 55 | 
                def m_photo_url(self):  | 
            
| 56 | 
                -        return u'{0}/media/{1}'.format(settings.DOMAIN, self.m_photo_path) if self.m_photo_path else ''
               | 
            |
| 56 | 
                +        return u'{0}/{1}'.format(settings.IMG_DOMAIN, self.m_photo_path) if self.m_photo_path else ''
               | 
            |
| 57 | 57 | 
                 | 
            
| 58 | 58 | 
                @property  | 
            
| 59 | 59 | 
                def l_photo_url(self):  | 
            
| 60 | 
                -        return u'{0}/media/{1}'.format(settings.DOMAIN, self.l_photo_path) if self.l_photo_path else ''
               | 
            |
| 60 | 
                +        return u'{0}/{1}'.format(settings.IMG_DOMAIN, self.l_photo_path) if self.l_photo_path else ''
               | 
            |
| 61 | 61 | 
                 | 
            
| 62 | 62 | 
                @property  | 
            
| 63 | 63 | 
                def r_photo_url(self):  | 
            
| 64 | 
                -        return u'{0}/media/{1}'.format(settings.DOMAIN, self.r_photo_path) if self.r_photo_path else ''
               | 
            |
| 64 | 
                +        return u'{0}/{1}'.format(settings.IMG_DOMAIN, self.r_photo_path) if self.r_photo_path else ''
               | 
            |
| 65 | 65 | 
                 | 
            
| 66 | 66 | 
                def _data(self):  | 
            
| 67 | 67 | 
                         return {
               | 
            
                @@ -16,6 +16,7 @@ from utils.uuid_utils import curtailUUID  | 
            ||
| 16 | 16 | 
                from utils.watermark_utils import watermark_wrap  | 
            
| 17 | 17 | 
                 | 
            
| 18 | 18 | 
                import os  | 
            
| 19 | 
                +import shortuuid  | 
            |
| 19 | 20 | 
                 | 
            
| 20 | 21 | 
                 | 
            
| 21 | 22 | 
                def uuid_init(request):  | 
            
                @@ -85,13 +86,13 @@ def upload_photo(request):  | 
            ||
| 85 | 86 | 
                photo_id = curtailUUID(PhotosInfo, 'photo_id')  | 
            
| 86 | 87 | 
                 | 
            
| 87 | 88 | 
                _, extension = os.path.splitext(photo.name)  | 
            
| 88 | 
                -    m_photo_path = 'photo/{photo_id}_m{extension}'.format(photo_id=photo_id, extension=extension)
               | 
            |
| 89 | 
                +    m_photo_path = 'photo/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=extension)
               | 
            |
| 89 | 90 | 
                 | 
            
| 90 | 91 | 
                if default_storage.exists(m_photo_path):  | 
            
| 91 | 92 | 
                default_storage.delete(m_photo_path)  | 
            
| 92 | 93 | 
                default_storage.save(m_photo_path, photo)  | 
            
| 93 | 94 | 
                 | 
            
| 94 | 
                -    p_photo_path = 'photo/{photo_id}_p{extension}'.format(photo_id=photo_id, extension=extension)
               | 
            |
| 95 | 
                +    p_photo_path = 'photo/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=extension)
               | 
            |
| 95 | 96 | 
                watermark_wrap(  | 
            
| 96 | 97 | 
                         os.path.join(settings.MEDIA_ROOT, m_photo_path).replace('\\', '/'),
               | 
            
| 97 | 98 | 
                settings.WATERMARK_LOGO,  |